package com.czd.support.util;

import com.sun.org.apache.xml.internal.security.utils.Base64;

/**
 * Created with IntelliJ IDEA.
 * Author: Jerry.hu
 * Create: Jerry.hu (14-8-27 14:26)
 * Description:
 * To change this template use File | Settings | File Templates.
 */
@SuppressWarnings("restriction")
public class BASE64Utils {
	/**
	 * BASE64解密
	 * @param key
	 * @return
	 * @throws Exception
	 */
	public static String  decryptBASE64(String key) throws Exception {
		return new String(Base64.decode(key));
		
	}

	/**
	 * BASE64加密
	 * @param key
	 * @return
	 * @throws Exception
	 */
	public static String encryptBASE64(String  key) throws Exception {
		return Base64.encode(key.getBytes());
	}

	public static void main(String[] args) throws Exception
	{
		String data = BASE64Utils.encryptBASE64("10000");
		System.out.println("加密后："+data);

		System.out.println("解密后："+BASE64Utils.decryptBASE64(data));
	}
}
